package zzzzz_just_for_test;

import java.lang.ref.WeakReference;

public class D
{
    WeakReference<A> weakA;
    public D(A a)
    {
        WeakReference<A> weakA = new WeakReference<A>(a);
    }
    public A getA()
    {
        return weakA.get();
    }

    public static void main(String[] args) {
        A a = new A();
        D b = new D(a);
        a = null;
        b.getA();   // 返回null
    }
}

